#ifndef __HDVB_DVBENC_H
#define __HDVB_DVBENC_H
/*
    libhdvbd - Library for building sophisticated DVB applications
    Copyright (C) 2012 Tony Houghton <h@realh.co.uk>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/* Convert DVB-encoded strings to UTF-8 etc */

#include <glib.h>

#include <time.h>

G_BEGIN_DECLS

/* All output strings are allocated with g_malloc() */

char *
hdvb_dvb_str_to_utf8(const guint8 *s, int l);

inline static guint
hdvb_bcd8(guint8 bcd)
{
    return (bcd >> 4) * 10 + (bcd & 0xf);
}

inline static time_t
hdvb_dvb_mjd_to_unix_time(int mjd)
{
    return (mjd - 40587) * 86400;
}

G_END_DECLS

#endif /* __HDVB_DVBENC_H */
